home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d953.lha
/
LHA_DOpus
/
LHA.dopus
next >
Wrap
Text File
|
1993-11-12
|
4KB
|
194 lines
/* DOPUS-LHA AREXX SCRIPT by Michiel Pelt
*
* Lists selected archive in current window and installs handler to deal
* with it.
* Double-click on 'Quit' to quit
* Double-click on 'AddFiles' to add all selected files to the archive
* Double-click on 'ExtractSelected' to extract all selected files from the archive
* Double-click on 'RemoveSelected' to remove all selected files from the archive
* Click-m-click or double-click on files to extract single files
*/
address 'DOPUS.1'
options results
'busy on'
'toptext' 'lha interface'
/* add rexxsupport.library */
IF ~SHOW('L', "rexxsupport.library") THEN DO
IF ADDLIB("rexxsupport.library",0,-30,0) THEN
'TopText' "Opened rexxsupport.library."
ELSE DO
'TopText' "Rexxsupport.library not found"
EXIT 10
END
END
/* get archive */
'getnextselected'
archiefname = result
'status 13 -1' /* current directory */
path = result
archief = '"'path || archiefname'"'
OPENPORT('LHAPort')
CALL ShowArchive
'busy off'
DO FOREVER
IF WAITPKT('LHAPort') THEN
DO
pakket = GETPKT('LHAPort')
actie = GETARG(pakket, 0)
i = GETARG(pakket, 1)
text = GETARG(pakket, 2)
user = GETARG(pakket, 3)
REPLY(pakket, 0)
'busy on'
IF actie=1 THEN 'OtherWindow' /* destwindow active */
IF user=1 THEN /* 'quit' */
DO
'OtherWindow'
'busy off'
'ClearWin'
EXIT
END
ELSE IF user = 2 THEN /* addfiles */
IF actie = 1 THEN /* double-click */
DO
'status 13 -1' /* destination path */
destpath = '"'result'"'
'GetNextSelected'
filename = result
DO WHILE ~(filename = 0)
ADDRESS COMMAND 'c:lha -axr a' archief destpath filename
'SelectFile' filename 0 1
'GetNextSelected'
filename = result
END
'OtherWindow'
CALL ShowArchive
END
ELSE NOP
ELSE IF user = 3 THEN /* extract files */
DO
'status 13 -1' /* destination path */
destpath = '"'result'"'
'OtherWindow'
'GetSelectedAll'
nums = result
DO WHILE (nums~='')
PARSE VAR nums num nums
IF ~(num=='') THEN
DO
'GetEntry' num+1
text = result
PARSE VAR text filename .
ADDRESS COMMAND 'c:lha x' archief destpath filename
END
END
'OtherWindow'
'Rescan'
'OtherWindow'
END
ELSE IF user = 4 THEN /* remove files */
DO
'OtherWindow'
'GetSelectedAll'
nums = result
DO WHILE (nums~='')
PARSE VAR nums num nums
IF ~(num=='') THEN
DO
'GetEntry' num+1
text = result
PARSE VAR text filename .
ADDRESS COMMAND 'c:lha d' archief filename
END
END
CALL ShowArchive
END
ELSE
DO /* extract doubleclicked or clickmclicked files */
'status 13 -1'
destpath = '"'result'"'
PARSE VAR text filename osize date time .
ADDRESS COMMAND 'c:lha x' archief destpath filename
'Rescan'
'OtherWindow'
END
'busy off'
END
END
/* open lha archive and list in window */
/* archivename should be in 'archief' */
ShowArchive:
ADDRESS COMMAND 'c:lha >t:file v' archief
IF RC>0 THEN DO
'TopText' "LHA-error"
EXIT 10
END
'ClearWin'
'SetWinTitle' archiefname
OPEN('file','t:file','R')
/* control entries in red */
'AddCustEntry Quit 1 7 -1 1 1'
'AddCustEntry AddFiles 2 7 -1 1 1'
'AddCustEntry ExtractSelected 3 7 -1 1 1'
'AddCustEntry RemoveSelected 4 7 -1 1 1'
/* skip status lines */
DO i=1 TO 5 WHILE ~EOF('file')
entry = READLN('file')
END
stop = 0
DO WHILE (~EOF('file') & (stop ~= 1))
entry = READLN('file')
/* skip comment lines */
IF ~(LEFT(entry,1) == ':') THEN
DO
PARSE VAR entry osize psize ratio date time filename .
entry = filename
IF LENGTH(entry)>0 THEN
DO
pos = MAX(50,10*((LENGTH(entry)+LENGTH(osize)+2)%10+1))
entry = OVERLAY(osize, entry, pos - LENGTH(osize))
entry = OVERLAY(date, entry, pos + 1)
entry = OVERLAY(time, entry, pos + 11)
entry = '"'entry'"'
'AddCustEntry' entry '5 -1 -1 1 1'
END
ELSE stop = 1
END
END
CLOSE('file')
'delete t:file'
'AddCustHandler LHAPort'
RETURN